*****************Characteristics (Table 4)*****************

import delimited "TwoPerson.csv", clear
// import delimited "C:\Users\stanton_hudja\Desktop\Research Tournament\Pooled.csv", clear


gen period=mod(decisionnumber,10)
gen first_period=0
replace first_period=1 if period==1
replace period=10 if period==0

gen leader=0
replace leader=1 if (mycurrentbest==currentbest) & (currentbest>0)
gen follower=0
replace follower=1 if (mycurrentbest<currentbest)

egen subject=group(subjectid)
egen session=group(sessionid)
xtset subject

gen ICB=0
replace ICB=mycurrentbest if treatment==0 & numberofdraws>0

gen PCB=0
replace PCB=mycurrentbest if treatment==1

gen CB=0
replace CB=currentbest if treatment==2

replace risk=-risk // Normalizing based on coding
replace loss=-loss // Normalizing based on coding

gen private=0
gen leaderboard=0

replace private=1 if treatment==1
replace leaderboard=1 if treatment==2


*Pooled Regression
xtlogit decision leaderboard period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==1)|(treatment==2), re vce (cluster session)

*Private Feedback Regressions
xtlogit decision mycurrentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==1), re vce (cluster session)
xtlogit decision mycurrentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==1)& (leader==1), re vce (cluster session)
xtlogit decision mycurrentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==1)& (follower==1), re vce (cluster session)

*Leaderboard Feedback Regressions
xtlogit decision currentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==2), re vce (cluster session)
xtlogit decision currentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==2)& (leader==1), re vce (cluster session)
xtlogit decision currentbest period risk loss sunk grit compo acho extra agree neuro open cons if (treatment==2)& (follower==1), re vce (cluster session)


